<template>
  <div>
    <my-swiper :banner="banner"></my-swiper>
    <div>
      <h1 class="h1">热卖推荐</h1>
    </div>
  </div>
</template>

<script>
import { banner, typeProducts } from "../api/api";
import mySwiper from "../components/mySwiper.vue";
export default {
  components: { mySwiper },
  name: "Index",
  data() {
    return {
      banner: [],
      hot: [],
    };
  },
  activated() {},
  created() {
    this.getBanner();
    this.getHotData();
  },
  methods: {
    //获取轮播图数据
    async getBanner() {
      let res = await banner();
      this.banner = res.result;
    },
    //获取热卖数据
    getHotData() {
      typeProducts({
        key: "isHot",
        value: 1,
      }).then((res) => {
        this.hot = res.result;
      });
    },
  },
};
</script>

<style>
</style>